<template>
  <div id="app">
    <keep-alive>
      <router-view />
    </keep-alive>
    <!-- <div style="color:red" @click="logOut">登出</div> -->
  </div>
</template>

<script>
import "@/assets/iconfont/iconfont.css";
import { initDictToLocalstorage } from "@/api/dict-data";
import router from '@/router'
import {logout} from '@/utils/H4a.js'
import { getSessionItem,removeSessionItem} from "@/utils/sessionStorage";
export default  {
  name:  'App',
    metaInfo() {
        return {
            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
            titleTemplate: title => {
                return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
            }
        }
    },
    data(){
      return{
            _beforeUnload_time:'',
            _gap_time:''
      }
    },
  created() {
    
    // if (router.currentRoute.path == '/bigscreen/viewer?reportCode=SecondView') {

    //   return
    // }
    this.queryDictName();
  },
   mounted() {
    // window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
    // window.addEventListener('unload', e => this.unloadHandler(e))
  },

  methods: {
    // logOut(){
    //   logout(getSessionItem(),()=>{
          
    //      })
    // },
    //   beforeunloadHandler(e){
    //   this._beforeUnload_time = new Date().getTime();
      
    // },
    // unloadHandler(e){
    //   this._gap_time = new Date().getTime() - this._beforeUnload_time;
    //   //判断是窗口关闭还是刷新
    //   if (this._gap_time <= 50) {
    //     //  removeSessionItem()
    //     // this.$store.commit("homeStatus/changeToken", null);
    //      logout(getSessionItem(),()=>{
          
    //      })
    //   }else {
        

    //   } 
    // },

    queryDictName() {
   
      // if (router.currentRoute.path == '/screenComponents/radarMap') return
      // if (router.currentRoute.path == '/screenComponents/relationMap') return
      // if (router.currentRoute.path == '/screenComponents/basicFileMap') return
      // if (router.currentRoute.path == '/screenComponents/recordMap') return
      // if (router.currentRoute.path == '/screenComponents/indicatorsMap') return
      // if (router.currentRoute.path == '/screenComponents/sandianMap') return
      // 初始化数据字典到浏览器本地缓存
     initDictToLocalstorage(()=>{})
    },
    
  },
  //  destroyed() {
  //   window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
  //   window.removeEventListener('unload', e => this.unloadHandler(e))
  // },

}
</script>
